import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,Image,ScrollView} from 'react-native';
import  TopTabNavigator from '../navigator/TopTabNavigator'
import Header  from '../component/header'
import Nav  from '../component/Nav'
import ScrollViewModule  from '../component/ScrollViewModule'
import RefreshModule  from '../component/RefreshModule'
import TextModule  from '../component/TextModule'
import RankingListModule  from '../component/RankingListModule'
import LikeListModule  from '../component/LikeListModule'
import px from '../util/px';
export default class HomePage extends Component {
  constructor(props){
      super(props)
      this._buttonAction=this._buttonAction.bind(this)
  }
  _buttonAction({index}){
      this.props.navigation.navigate("ClassPage")
  }
  render() {
    return <View style={styles.container}>
            <Header/>
            <ScrollView style={{flex:1}}>
            <Nav 
            buttonAction={this._buttonAction}
            iconList={
                [
                    {key:'nav_1',label:'分类',icon:require('../images/icon_nav_1.png')},
                    {key:'nav_2',label:'排行',icon:require('../images/icon_nav_2.png')},
                    {key:'nav_3',label:'女频',icon:require('../images/icon_nav_3.png')},
                    {key:'nav_4',label:'男频',icon:require('../images/icon_nav_4.png')},
                    {key:'nav_5',label:'书单',icon:require('../images/icon_nav_5.png')},

                ]
            }/>
            <Image
            style={{width:px(750),height:px(112)}}
            source={{uri:'http://img-tailor.11222.cn/pm/book/operate/2018020715462184.jpg'}}/>
            <View>
                <ScrollViewModule
                title={"精品推荐"}
                dataList={
                    [{id:'module_1',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_2',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_3',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_4',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_5',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_6',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_7',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_8',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'}]
                }/>
                <RefreshModule text="换一换"  isShowIcon={true}/>
            </View>
            <View style={{marginTop:px(16)}}>
                <ScrollViewModule
                title={"精品推荐"}
                dataList={
                    [{id:'module_1',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_2',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_3',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_4',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_5',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_6',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_7',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_8',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'}]
                }/>
                <TextModule   dataList={
                    [{id:'module_1',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_2',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    {id:'module_3',title:'不朽神帝',author:'项华',imgUrl:'http://img-tailor.11222.cn/bcv/big/201701131047373571.jpg'},
                    ]}/>
                 <RefreshModule text="换一换" isShowIcon={true}/>
            </View>
            <RankingListModule/>
            <LikeListModule/>
            </ScrollView>
    </View>
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
   
    backgroundColor: '#F5FCFF',
  }
});
